package Java基础;

/**
 * @Author: biubiu0002
 * @Date: 2021-03-29 18:10
 **/
public class 对象引用作为参数 {

    public static void main(String[] args) {
        对象引用作为参数 test = new 对象引用作为参数();
        Person person = new Person("a");
        System.out.println(person.getName());
        func(person);
        System.out.println(person.getName());



    }

    public static void func(Person personXinCan){
        personXinCan=new Person("b");
        personXinCan.name="hello";
        personXinCan.setName("c");
        System.out.println(personXinCan.getName());
//        personXinCan.setName("b");

    }
}
class Person{
    String name;

    public Person() {
    }

    public Person(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
